/*  This file is part of -_-.

    -_- is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    -_- is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with -_-.  If not, see <http://www.gnu.org/licenses/>.

    Copyright 2012 Oliver Katz */

#include <iostream>
#include "backend_directfb.h"

using namespace sleepyface;
using namespace sleepyface::visual;

int main(int argc, char *argv[])
{
	int e = 0;
	Backend b = Backend();
	if ((e = b.init(&argc, &argv)) != 0)
		cerr << "Backend::init <= " << e << "\n";

	b.rect(0, 0, b.getWidth(), b.getHeight(), 0x00, 0x00, 0x00, 0xff);
	b.line(0, 0, 100, 100, 0xff, 0xff, 0xff, 0xff);
	b.update();

	if ((e = b.image(200, 10, "data/kitten.jpg")) != 0)
		cerr << "Backend::image <= " << e << "\n";
	b.update();

	if ((e = b.loadFont("sans", "data/DejaVuSans.ttf", 16)) != 0)
		cerr << "Backend::loadFont <= " << e << "\n";
	if ((e = b.text(300, 10, 0xff, 0x00, 0x00, 0xff, "sans", "hello, world")) != 0)
		cerr << "Backend::text <= " << e << "\n";
	b.unloadFont("sans");
	b.update();

	b.rect(0, 0, b.getWidth(), b.getHeight(), 0xff, 0xff, 0xff, 0xff);
	b.update(0, 200, 100, 300);

	b.waitForEvents();

	b.halt();
	return 0;
}

